/*
 *   Copyright 1999-2016 Asiainfo Technologies(China),Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package com.asiainfo.redis.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @version v 1.0 on 2016/8/9 17:50
 * @auther william.xu
 */
//@DynamicInsert
@Entity
@Table(name="REDIS_CLUSTER_BUSI_TYPE_REF")
@SequenceGenerator(name="REDIS_CLUSTER_BUSI_TYPE_SEQ_",sequenceName="REDIS_CLUSTER_BUSI_TYPE_SEQ",allocationSize=1)
public class ClusterBusiTypeRef {

    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE,generator="REDIS_CLUSTER_BUSI_TYPE_SEQ_")
    @Column(name = "ID")
    private Long id;

    @Column(name = "CLUSTER_ID")
    private Long clusterId;

    @Column(name = "BUSI_TYPE_ID")
    private Long busiTypeId;

    @Column(name = "CURRENT_CLUSTER_ID")
    private Long currentClusterId;

    @Transient
    private String currentClusterName;

    @Column(name = "REFRESH_STATUS")
    private Integer refreshStatus;

    @Column(name = "REFRESH_ERROR_MSG")
    private String refreshErrorMsg;

    //@JsonSerialize
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    //@Temporal(TemporalType.TIMESTAMP)
    @Column(name = "REFRESH_START_TIME")
    private java.util.Date refreshStartTime;

    //@JsonSerialize
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    @Column(name = "REFRESH_END_TIME")
    private java.util.Date refreshEndTime;

    @Column(name="HOST_RUN_ON")
    private String hostRunOn;

//    @Column(name = "LAST_REFRESH_LOG_ID")
//    private Long lastRefreshLogId;


    @Transient
    //@Column(name = "CLUSTER_NAME", updatable = false, insertable = false)
    private String clusterName;

    @Transient
    //@Column(name = "BUSI_CODE", updatable = false, insertable = false)
    private String busiCode;

    @Transient
    //@Column(name = "BUSI_NAME", updatable = false, insertable = false)
    private String busiName;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getClusterId() {
        return clusterId;
    }

    public void setClusterId(Long clusterId) {
        this.clusterId = clusterId;
    }

    public Long getBusiTypeId() {
        return busiTypeId;
    }

    public void setBusiTypeId(Long busiTypeId) {
        this.busiTypeId = busiTypeId;
    }

    public Long getCurrentClusterId() {
        return currentClusterId;
    }

    public void setCurrentClusterId(Long currentClusterId) {
        this.currentClusterId = currentClusterId;
    }

    public Integer getRefreshStatus() {
        return refreshStatus;
    }

    public void setRefreshStatus(Integer refreshStatus) {
        this.refreshStatus = refreshStatus;
    }

    public String getRefreshErrorMsg() {
        return refreshErrorMsg;
    }

    public void setRefreshErrorMsg(String refreshErrorMsg) {
        this.refreshErrorMsg = refreshErrorMsg;
    }

    public Date getRefreshStartTime() {
        return refreshStartTime;
    }

    public void setRefreshStartTime(Date refreshStartTime) {
        this.refreshStartTime = refreshStartTime;
    }

    public Date getRefreshEndTime() {
        return refreshEndTime;
    }

    public void setRefreshEndTime(Date refreshEndTime) {
        this.refreshEndTime = refreshEndTime;
    }

    public String getClusterName() {
        return clusterName;
    }

    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }

    public String getBusiCode() {
        return busiCode;
    }

    public void setBusiCode(String busiCode) {
        this.busiCode = busiCode;
    }

    public String getBusiName() {
        return busiName;
    }

    public void setBusiName(String busiName) {
        this.busiName = busiName;
    }

    public String getHostRunOn() {
        return hostRunOn;
    }

    public void setHostRunOn(String hostRunOn) {
        this.hostRunOn = hostRunOn;
    }

    public String getCurrentClusterName() {
        return currentClusterName;
    }

    public void setCurrentClusterName(String currentClusterName) {
        this.currentClusterName = currentClusterName;
    }

}
